package com.example.demo.entity;

import com.example.demo.test.LongToString;
import com.example.demo.test.ReplacePassword;
import com.example.jpa.crud.annotation.Crud;

import com.example.jpa.crud.annotation.CrudField;
import com.example.jpa.crud.model.DisplayStrategy;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

import static jakarta.persistence.GenerationType.IDENTITY;

@Entity
@Table(name = "t_user")
@Crud(name = "users")
public class User {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @CrudField(display = DisplayStrategy.REPLACE, replace = LongToString.class)
    public long id;

    public String name;

    public String email;

    public int age;

    @CrudField(display = DisplayStrategy.REPLACE, replace = ReplacePassword.class)
    public String password;

    public boolean isAdmin;

}